<?php

class ServiceAction extends PublicAction
{
    public function index($catid = '', $module = '')
    {
        $this->Urlrule = F('Urlrule');
        if (empty($catid)) {

            $catid = I('get.id');
        }
        $module = 'Page';
        if ($catid) {

            $cat = $this->categorys[$catid];

            $this->assign('module_name', $module);

            unset($cat['id']);

            $this->assign($cat);

            $cat['id'] = $catid;

            $this->assign('catid', $catid);

        }

        $seo_title = $cat['title'] ? $cat['title'] : $cat['catname'];

        $this->assign('seo_title', $seo_title);

        $this->assign('seo_keywords', $cat['keywords']);

        $this->assign('seo_description', $cat['description']);

        $service = M('service');

        $title_desc = $service->find(1);

        $where['id'] = array('neq', 1);
        $where['status'] = 1;

        $content = $service->where($where)->select();

        foreach ($content as &$value){
            $pics = explode(':::', $value['pics']);
            foreach ($pics as $v){
                $arr  = explode('|', $v);
                $result[] = array_shift($arr);
                $value['pics'] = $result;
            }
        }
        $this->assign(['title_desc' => $title_desc, 'content' => $content]);
        $this->display('list');
    }
}